<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>SUOYUEの疫情地图</title>

    <link rel="shortcut icon" th:href="@{/images/favicon.ico}" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"/>
    <link rel="stylesheet" href="../static/css/me.css" th:href="@{/css/me.css}">
</head>
<body>
<!--导航栏-->
<nav class="ui inverted gird-header" >
    <div class="ui container">
        <div class="ui inverted secondary stackable menu">
            <h2 class="ui olive header item" style="font-family: STSong">SUOYUE</h2>
            <a href="#" th:href="@{/}" class="m-item item m-mobile-hide"><i class="home icon"></i><span th:text="#{index.home}">首页</span></a>
            <a href="#" th:href="@{/hotArticle}" class="m-item item m-mobile-hide"><i class="clone outline icon"></i><span th:text="#{index.hotArticle}">热门文章</span></a>
            <a href="#" th:href="@{/newArticle}" class="m-item item m-mobile-hide"><i class="clock icon"></i><span th:text="#{index.time}">时间轴</span></a>
            <a href="#" th:href="@{/activeUser}" class="m-item item m-mobile-hide"><i class="clone outline icon"></i><span th:text="#{index.user}">活跃好友</span></a>
            <a href="#" th:href="@{/message}" class="m-item item m-mobile-hide"><i class="book icon"></i><span th:text="#{index.messages}">交流区</span></a>
            <a href="#" th:href="@{/echarts}" class="active m-item item m-mobile-hide"><i class="clone outline icon"></i><span th:text="#{index.map}">疫情地图</span></a>
            <!--  创作中心  -->
            <h5 class="item" style="font-family: STSong"><a href="#" th:href="@{/user/index}" class="ui inverted green rounded button" ><i class="edit icon"></i>创作中心</a></h5>
            <!--  用户头像  -->
            <div class="left m-item m-mobile-hide menu" th:if="${session.user}">
                <div class="ui dropdown item">
                    <div class="text">
                        <img class="ui avatar image" src="../../static/images/me.jpg" th:src="${session.user.avatar}">
                    </div>
                    <i class="dropdown icon"></i>
                    <div class="menu">
                        <a href="" th:href="@{/logout}" class="item">注销</a>
                    </div>
                </div>
            </div>
            <!--  搜索栏  -->
            <div class="right m-item item m-mobile-hide">
                <form name="search" action="#" th:action="@{/search}" method="post" target="_blank">
                    <div class="ui icon transparent input m-margin-tb-tiny" style="color: white">
                        <input style="color: white" type="text" name="query" placeholder="Search....">
                        <i onclick="document.forms['search'].submit()" class="search link icon"></i>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <!--手机端收起导航栏-->
    <a href="#" class="ui menu toggle black icon button m-right-top m-mobile-show">
        <i class="sidebar icon"></i>
    </a>
</nav>

<!--顶部图片-->
<div class="m-bg-type_outer" style="width: 100%;height: 36%">
    <img src="../static/images/databg.jpg" th:src="@{/images/databg.jpg}" alt="" class="ui m-bg image" style="width: 100%;height: 100%">
    <div class="m-bg-class_cover">
        <div class="ui container" style="position: relative ;bottom: -590px;">
            <div class="m-font-size-title m-right-bottom" align="center" style="font-family:'STXingkai'">疫情地图</div>
            <div class="m-font-size-text-init-title m-margin-top" align="center">若真若幻，惜情惜义。若你微笑，自得繁花。若许一世，为何负情。</div>
        </div>
    </div>
</div>

<!--中间内容-->
<div id="waypoint" class="m-padded-tb animated fadeIn">
    <div class="ui container">
        <!-- 标签信息 -->
        <div class="ui segment m-padded-tb-large m-opacity">

            <div class="ui container box-shadow-max m-opacity-tiny" align="center">
                <div class="ui big labeled button m-margin-all" th:each="item,userStat: ${blogTotalMap}">
                    <a class="ui olive right pointing label" th:text="${userStat.current.key}">文章数</a>
                    <a class="ui green left pointing label" th:text="${userStat.current.value}">24</a>
                </div>
            </div>

            <div class="ui padded segment m-padded-tb-large m-opacity" align="center">
                <!-- 为ECharts准备一个具备大小（宽高）的Dom -->
                <div class="ui container">
                    <div id="echartEpidemic" style="width:100%;height:500px"></div>
                </div>
            </div>

        </div>
    </div>
</div>

<br>
<br>


<!--右下角-侧边栏-->
<div id="toolbar" class="m-padded m-fixed m-right-bottom" style="display: none">
    <div class="ui vertical icon buttons ">
        <div id="toTop-button" class="ui icon button" ><i class="chevron up icon"></i></div>
    </div>
</div>

<!--底部栏-->
<footer class="ui inverted vertical segment m-padded-tb-massive m-opacity" th:replace="_fragments :: footer">
</footer>
<!--通用script：使用div标签或thymeleaf模板的th:block-->
<th:block th:replace="_fragments :: script">
</th:block>

<script src="//cdn.jsdelivr.net/npm/jquery.scrollto@2.1.2/jquery.scrollTo.min.js"></script>
<script src="../static/lib/waypoints/jquery.waypoints.min.js" th:src="@{/lib/waypoints/jquery.waypoints.min.js}"></script>
<script src="../static/lib/echarts/echarts.min.js" th:src="@{/lib/echarts/echarts.min.js}"></script>
<script src="../static/lib/echarts/china.js" th:src="@{/lib/echarts/china.js}"></script>

<!--雪花效果-->
<script src="http://www.lmlblog.com/winter/templets/xq/js/snowy.js"></script>
<script src="http://www.lmlblog.com/blog/12/js/Snow.js"></script>
<style type="text/css">
    .snow-container{position:fixed;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index: 100 !important;}
</style>
<div class="snow-container"><canvas width="100%" height="657"></canvas></div>

<!--看板娘-->
<!--<script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>-->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome/css/font-awesome.min.css">
<script src="https://cdn.jsdelivr.net/gh/stevenjoezhang/live2d-widget/autoload.js"></script>
<!--看板娘-自定义-->
<div id="waifu" class="cartoon">
    <div id="waifu-tips" class="cartoonText">好久不见，日子过得好快呢……</div>
    <canvas id="live2d" width="800" height="800" class="cartoonCan"></canvas>
    <div id="waifu-tool">
        <span class="fa fa-lg fa-comment"></span>
        <span class="fa fa-lg fa-paper-plane"></span>
        <span class="fa fa-lg fa-user-circle"></span>
        <span class="fa fa-lg fa-street-view"></span>
        <span class="fa fa-lg fa-camera-retro"></span>
        <span class="fa fa-lg fa-info-circle"></span>
        <span class="fa fa-lg fa-times"></span>
    </div>
</div>

<script>

    $('.menu.toggle').click(function () {
        $('.m-item').toggleClass('m-mobile-hide');
    });

    //右下角点击滚上去事件
    $('#toTop-button').click(function () {
        $(window).scrollTo(0,500);
    });
    //滚动侦测
    var waypoint = new Waypoint({
        element: document.getElementById('waypoint'),
        handler: function(direction) {
            if (direction == 'down') {
                $('#toolbar').show(100);
            } else {
                $('#toolbar').hide(500);
            }
            console.log('Scrolled to waypoint!  ' + direction);
        }
    })

    // 将Java中的text内容 ， 转换为网页脚本中的变量data
    var data ;
    $(function(){
        //发送请求获取最新博客日访问量数据
        $.get("/echart/totaoData", {}, function (resp) {
            // fillToChart(resp.data);
            data = resp.data;
        });
    }, "json");
    console.log(data);
    // 基于地图绘制区域， 创建按一个绘制图表的实例
    var myChart = echarts.init(echartEpidemic);
    // 3.3编写配置的信息
    var opt = {
        //2.3.1标题的配置
        title:{
            text:"疫情数据",
            subtext:"数据来源于网络",
            sublink:"https://www.kaikeba.com"
        },
        //2.3.2数据提示窗配置
        tooltip:{
            trigger:"item",//触发器，item表示：鼠标放入数据区域触发
            formatter:"{b}<br/>{c}(人)"// 弹出的提示数据， b表示地区名称  c表示感染人数
        },
        //2.3.3疫情地图的视觉方案
        visualMap:{
            type:"piecewise",
            pieces:[
                {gt:1500,color:"red",colorAlpha:1},
                {gt:1000,lte:1500,color:"red",colorAlpha:0.8},
                {gt:500,lte:1000,color:"red",colorAlpha:0.6},
                {gt:200,lte:500,color:"red",colorAlpha:0.4},
                {gt:100,lte:200,color:"red",colorAlpha:0.2},
                {lt:100,color:"red",colorAlpha:0.1},
            ]
        },
        //2.3.4 数据源配置
        series:[
            {
                name:"各省份确诊病例",//数据名
                zomm:1.2,//缩放倍数
                type:"map",//绘图类型 , map表示地图
                map:"china",//引入的地图,china表示中国
                roam:true,//开启缩小放大和移动地图
                label:{//身份显示的标签
                    show:true,//确定显示
                    formatter:"{b}",//显示城市名称
                    fontSize:8//字体大小8
                },
                data:data   //数据源data 来自于API读取.
            }
        ]
    };
    //将配置的信息 给到地图
    myChart.setOption(opt);
</script>

</body>
</html>